home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
libs
/
avril20
/
example3.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-01-21
|
1KB
|
54 lines
/* EXAMPLE3 -- surface maps */
/* Written by Bernie Roehl, April 1994 */
#include "avril.h"
#include <stdlib.h> /* needed for rand() */
void main()
{
FILE *infile;
vrl_Light *light;
vrl_Camera *camera;
vrl_Shape *colorthing = NULL;
vrl_Surfacemap *map1, *map2;
int i;
vrl_SystemStartup();
map1 = vrl_SurfacemapCreate(6);
map2 = vrl_SurfacemapCreate(6);
for (i = 0; i < 6; ++i)
{
vrl_SurfacemapSetSurface(map1, i, vrl_SurfaceCreate(i + 1));
vrl_SurfacemapSetSurface(map2, i, vrl_SurfaceCreate(7 + i));
}
infile = fopen("colorful.plg", "r");
if (infile)
{
colorthing = vrl_ReadPLG(infile);
fclose(infile);
}
light = vrl_LightCreate();
vrl_LightRotY(light, float2angle(45));
vrl_LightRotX(light, float2angle(45));
camera = vrl_CameraCreate();
vrl_CameraMove(camera, 0, 100, -50);
for (i = 0; i < 10; ++i)
{
vrl_Object *obj = vrl_ObjectCreate(colorthing);
if (i & 1)
vrl_ObjectSetSurfacemap(obj, map1);
else
vrl_ObjectSetSurfacemap(obj, map2);
vrl_ObjectMove(obj, rand() % 1000, rand() % 1000, rand() % 1000);
}
vrl_SystemRun();
}